from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
from po.base_page import BasePage


class MyAssets(BasePage):

    def choose_tab_by_content_item(self, content_item):
        """
        根据item选择对应的版块
        :param content_item:
        :return:
        """
        title = self.driver.find_element(By.CLASS_NAME, 'd2-theme-item-ld-aside')
        ActionChains(self.driver).move_to_element(title).perform()
        options = self.driver.find_elements(By.CLASS_NAME, 'content-item')
        for option in options:
            if content_item == option.text:
                option.click()
                ActionChains(self.driver).move_by_offset(xoffset=1000, yoffset=500).perform()
                break
